import { createRouter, createWebHistory } from 'vue-router'
import LoginView from '@/views/LoginView.vue'
import LayOut from '@/views/LayOut.vue'
import HomeView from '@/views/LayOut/HomeView.vue'
import ProListView from '@/views/LayOut/Product/ProListView.vue'
import ProReleaseView from '@/views/LayOut/Product/ProReleaseView.vue'
import ManageListView from '@/views/LayOut/Management/ManageListView.vue'
import ManageIncludeView from '@/views/LayOut/Management/AdminManageView.vue'
import Test01_View from '@/views/LayOut/Test/Test01_View.vue'
import Test02_View from '@/views/LayOut/Test/Test02_View.vue'
import NoticeList from '@/views/LayOut/Notice/NoticeList.vue'
import NoticeSetting from '@/views/LayOut/Notice/NoticeSetting.vue'
import TuserView from '@/views/LayOut/Text/TuserView.vue'
import TmanageView from '@/views/LayOut/Text/TmanagementView.vue'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/login'
    },
    {
      path: '/login',
      name: 'login',
      component: LoginView,
    },
    {
      path: '/layout',
      name: 'layout',
      component: LayOut,
      children: [
        {
          path: '/home',
          name: 'home',
          component: HomeView,
          meta: {
            title: '首页',
            showInMenu: true,
            isTopLevel: true
          }
        },
        {
          path: '/prolist',
          name: 'prolist',
          component: ProListView,
          meta: {
            title: '商品列表',
            showInMenu: true,
            parentMenu: 'product',
            parentTitle: '商品管理'
          }
        },
        {
          path: '/prorelease',
          name: 'prorelease',
          component: ProReleaseView,
          meta: {
            title: '发布商品',
            showInMenu: true,
            parentMenu: 'product',
            parentTitle: '商品管理'
          }
        },
        {
          path: '/managelist',
          name: 'managelist',
          component: ManageListView,
          meta: {
            title: '用户列表管理',
            showInMenu: true,
            parentMenu: 'user',
            parentTitle: '用户管理'
          }
        },
        {
          path: '/manageinclude',
          name: 'manageinclude',
          component: ManageIncludeView,
          meta: {
            title: '管理员管理',
            showInMenu: true,
            parentMenu: 'user',
            parentTitle: '用户管理'
          }
        },
        {
          path: '/noticelist',
          name: 'noticelist',
          component: NoticeList,
          meta: {
            title: '公告列表管理',
            showInMenu: true,
            parentMenu: 'notices',
            parentTitle: '通知公告'
          }
        },
        {
          path: '/noticesetting',
          name: 'noticesetting',
          component: NoticeSetting,
          meta: {
            title: '公告分类管理',
            showInMenu: true,
            parentMenu: 'notices',
            parentTitle: '通知公告'
          }
        },
        {
          path: '/textuser',
          name: 'textuesr',
          component: TuserView,
          meta: {
            title: '用户管理',
            showInMenu: true,
            parentMenu: 'text',
            parentTitle: '其他功能'
          }
        },
        {
          path: '/textmanage',
          name: 'textmanage',
          component: TmanageView,
          meta: {
            title: '文章管理',
            showInMenu: true,
            parentMenu: 'text',
            parentTitle: '其他功能'
          }
        },
        {
          path: '/test01',
          name: 'test01',
          component: Test01_View,
          meta: {
            title: 'Test01',
            showInMenu: true,
            parentMenu: 'test',
            parentTitle: '测试功能'
          }
        },
        {
          path: '/test02',
          name: 'test02',
          component: Test02_View,
          meta: {
            title: 'Test02',
            showInMenu: true,
            parentMenu: 'test',
            parentTitle: '测试功能'
          }
        },
      ]
    },
  ],
})

export default router
